<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp"%>
<title>用户注册</title>
</head>
<body style="background: #f1f1f1">
	<div class='window'>
		<fieldset class="layui-elem-box" style="margin: 10px;">
			<legend>注册</legend>

			<div class="layui-field-box">
				<form class="layui-form layui-form-pane" method="post">
					<div class="layui-form-item">
						<label class="layui-form-label">账号</label>
						<div class="layui-input-inline">
							<input type="text" name="code" class="layui-input"
								lay-verify="required" placeholder="请输入账号" />
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">密码</label>
						<div class="layui-input-inline">
							<input type="password" name="pass" class="layui-input"
								lay-verify="required" placeholder="请输入密码" />
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">姓名</label>
						<div class="layui-input-inline">
							<input type="text" name="name" class="layui-input"
								lay-verify="required" placeholder="请输入姓名" />
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label"> 
						      <img class="layui-img" alt="验证码" src="/st_company/AuthCodeServlet"
                                  onclick="this.src='/st_company/AuthCodeServlet?'+Math.random()" />
						</label> 
						<div class="layui-input-inline">
						      <input type="text" name="authcode" class="layui-input"
								lay-verify="required" placeholder="请输入验证码" />
						</div>
					</div>
					
					<div class="layui-form-item">
						<div class="layui-input-inline">
							<input value="注册" type="button" class="layui-btn" lay-submit
								lay-filter="reg"/>&nbsp;&nbsp;
                            <input value="重置" type="reset" class="layui-btn layui-btn-primary"/>
						</div>
						<input value="返回登录" type="button" class="layui-btn"
							onclick="goJspLogin()" />
					</div>
					<input type="hidden" name="action" value="reg">
				</form>
			</div>
		</fieldset>
	</div>
	
	<script type="text/javascript">
        formSubmit('/employee', 'submit(reg)', 'text', function(data) {
        	console.log(data);
			if (data == 1)
				layer.msg("注册成功");
			if (data == "authcode")
                layer.msg("注册失败，验证码错误");
			if (data == "repeat")
				layer.msg("注册失败，账号重复");
			if (data == null)
				layer.msg("注册失败，异常");
	    });
        
        function goJspLogin(){
            location.href=base.app+"/web/login.jsp";
        }
	</script>
</body>
</html>